package com.ruoyi.supermarket.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.supermarket.bo.SaleCountBo;
import com.ruoyi.supermarket.bo.SupplyAndDemandBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.supermarket.mapper.CommodityMapper;
import com.ruoyi.supermarket.domain.Commodity;
import com.ruoyi.supermarket.service.ICommodityService;

/**
 * 商品信息Service业务层处理
 * 
 * @author lxl
 * @date 2024-07-21
 */
@Service
public class CommodityServiceImpl implements ICommodityService 
{
    @Autowired
    private CommodityMapper commodityMapper;

    /**
     * 查询商品信息
     * 
     * @param cid 商品信息主键
     * @return 商品信息
     */
    @Override
    public Commodity selectCommodityByCid(Long cid)
    {
        return commodityMapper.selectCommodityByCid(cid);
    }

    /**
     * 查询商品信息列表
     * 
     * @param commodity 商品信息
     * @return 商品信息
     */
    @Override
    public List<Commodity> selectCommodityList(Commodity commodity)
    {
        return commodityMapper.selectCommodityList(commodity);
    }

    /**
     * 新增商品信息
     * 
     * @param commodity 商品信息
     * @return 结果
     */
    @Override
    public int insertCommodity(Commodity commodity)
    {
        return commodityMapper.insertCommodity(commodity);
    }

    /**
     * 修改商品信息
     * 
     * @param commodity 商品信息
     * @return 结果
     */
    @Override
    public int updateCommodity(Commodity commodity)
    {
        return commodityMapper.updateCommodity(commodity);
    }



    /**
     * 批量删除商品信息
     * 
     * @param cids 需要删除的商品信息主键
     * @return 结果
     */
    @Override
    public int deleteCommodityByCids(Long[] cids)
    {
        return commodityMapper.deleteCommodityByCids(cids);
    }

    @Override
    public List<Commodity> category(Commodity commodity)
    {
        return commodityMapper.categoryList(commodity);
    }

    @Override
    public Commodity selectCategoryByGid(Long gid)
    {
        return commodityMapper.categoryByGid(gid);
    }

    @Override
    public List<SaleCountBo> salecount() {
        return  commodityMapper.salecount();
    }

    @Override
    public List<SaleCountBo> salegetcount() {
        return  commodityMapper.salegetcount();
    }

    @Override
    public List<SupplyAndDemandBO> SupplyAndDemand() {
        return commodityMapper.SupplyAndDemand();
    }

}
